package com.lql.lqlreader.widget

import android.app.Dialog
import android.content.Context
import android.os.Bundle
import com.lql.lqlreader.R
import kotlinx.android.synthetic.main.loading.*

/**
 * ClassName: LoadingDialog
 * Description: Show the loading animation
 */
class LoadingDialog(context: Context, themeResId:Int = R.style.loadingDialog): Dialog(context, themeResId) {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.loading)
        loadingAnimationView.repeatCount = Int.MAX_VALUE
        loadingAnimationView.speed = 1.8F
        loadingAnimationView.playAnimation()
    }

    override fun dismiss() {
        super.dismiss()
        loadingAnimationView.cancelAnimation()
    }
}